package com.lagou.edu.factory;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

public class Reader {
    List<String > names = new ArrayList<>();
    public Object beanReader(){
        return null;
    }



    public void doScanner(String packagePath) throws ClassNotFoundException {
//        URL url = this.getClass().getClassLoader().getResource( packagePath.replaceAll("\\.", "/"));
        URL url = this.getClass().getResource("/"+ packagePath.replaceAll("\\.", "/"));
//        URL url = this.getClass().getClassLoader().getResource("/");
        File classPath = new File(url.getFile());
        for (File file : classPath.listFiles()) {
            if (file.isDirectory()) {
                doScanner(packagePath + "." + file.getName());
            } else {
                if (!file.getName().endsWith(".class")) {
                    continue;
                }
                String className = (packagePath + "." + file.getName().replace(".class", ""));
                Class<?> aClass = Class.forName(className);

            }
        }

    }
}
